package org.openbravo.service.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.openbravo.base.provider.OBModulePrefixRequired;

/**
 * Defines the standard webservice interface which needs to be implemented by all webservices.
 * 
 * @author mtaal
 */

public interface WebService extends OBModulePrefixRequired {

  public enum ChangeAction {
    CREATE, UPDATE, DELETE
  }

  /**
   * Is called for the Http GET method.
   * 
   * @param path
   *          the HttpRequest.getPathInfo(), the part of the url after the context path
   * @param request
   *          the HttpServletRequest
   * @param response
   *          the HttpServletResponse
   */
  public void doGet(String path, HttpServletRequest request, HttpServletResponse response)
      throws Exception;

  /**
   * Is called for the Http POST method.
   * 
   * @param path
   *          the HttpRequest.getPathInfo(), the part of the url after the context path
   * @param request
   *          the HttpServletRequest
   * @param response
   *          the HttpServletResponse
   */
  public void doPost(String path, HttpServletRequest request, HttpServletResponse response)
      throws Exception;

  /**
   * Is called for the Http DELETE method.
   * 
   * @param path
   *          the HttpRequest.getPathInfo(), the part of the url after the context path
   * @param request
   *          the HttpServletRequest
   * @param response
   *          the HttpServletResponse
   */
  public void doDelete(String path, HttpServletRequest request, HttpServletResponse response)
      throws Exception;

  /**
   * Is called for the Http PUT method.
   * 
   * @param path
   *          the HttpRequest.getPathInfo(), the part of the url after the context path
   * @param request
   *          the HttpServletRequest
   * @param response
   *          the HttpServletResponse
   */
  public void doPut(String path, HttpServletRequest request, HttpServletResponse response)
      throws Exception;
}